from appium.webdriver.common.appiumby import AppiumBy
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# 等待弹窗出现并处理
def wait_for_popup_and_accept(driver):
    try:
        # 等待弹窗的某个元素可见
        WebDriverWait(driver, 10).until(
            EC.visibility_of_element_located((AppiumBy.ID, "弹窗元素的ID"))
        )
        # 查找并点击确认按钮
        accept_button = driver.find_element(AppiumBy.ID, "确认按钮的ID")
        accept_button.click()
    except Exception as e:
        print(f"弹窗未出现或处理失败: {e}")
